package com.itic.appbase.framework.type;

import com.itic.appbase.framework.utils.NumberStringHelper;

public enum TaxCompany {
	yh("yh","友惠自营","1"), jd("jd","京东","0.1");
	private String value;
	private String name;
	private String taxPerCent;
	TaxCompany(String value, String name,String taxPerCent) {
		this.name = name;
		this.value = value;
		this.taxPerCent = taxPerCent;
	}

	public String getTaxPerCent() {
		return taxPerCent;
	}

	public void setTaxPerCent(String taxPerCent) {
		this.taxPerCent = taxPerCent;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	
	public static TaxCompany getTaxCompany(String value) {
		TaxCompany TaxCompany = null;
		switch (value) {
		case "jd":
			TaxCompany = TaxCompany.jd;
			break;
		}
		return TaxCompany;
	}
	
	public static String calCommission(String commission,TaxCompany taxCompany) {
		String taxPercent = NumberStringHelper.subtractString("1",taxCompany.getTaxPerCent());
		String totalCommission = NumberStringHelper.divString(commission,taxPercent, 2);
		return totalCommission;
	}
}
